#pragma once

#include "../ptr/ptr.h"
#include "../ptr/ref.h"
#include "runnable.h"

namespace org {
namespace antban {
namespace thread {

class Thread : public ptr::Ref {
public:

	// Returns true if thread is running.
	bool isRunning();

	// Main thread function.
	virtual void run();

public:

	static ptr::Ptr<Thread> start(Runnable* pCommand);

protected:

	Thread();

	virtual ~Thread();

private:

	static void* threadFunc(void* pArg);

private:

	ptr::Ptr<Runnable> m_Command;

	void* m_pThreadInfo;
	
	bool m_Running;
};

} // namespace thread
} // namespace antban
} // namespace org
